package en.edu.zxj.mq.mqserver.mapper;

import en.edu.zxj.mq.mqserver.core.Binding;
import en.edu.zxj.mq.mqserver.core.Exchange;
import en.edu.zxj.mq.mqserver.core.MSGQueue;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * Description：操作数据库的类
 *
 * @author: zxj
 * @date: 2024-02-26
 * @time: 20:18:38
 */
@Mapper
public interface MetaMapper {
    // 建表操作
    void createExchangeTable();

    void createMSGQueueTable();

    void createBindingTable();

    // 相关的增删改查操作
    Integer insertExchange(Exchange exchange);

    Integer deleteExchangeByName(String name);

    List<Exchange> selectAllExchanges();

    Integer insertMSGQueue(MSGQueue msgQueue);

    Integer deleteMSGQueueByName(String name);

    List<MSGQueue> selectAllMSGQueues();


    Integer insertBinding(Binding binding);

    Integer deleteBinding(String exchangeName, String queueName);

    List<Binding> selectAllBindings();
}
